<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>添加新闻资讯</title>
	<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
	<script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
	<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
	<script type="text/javascript">
        function getCtxPath() {
            return "${ctxPath}";
        }
	</script>
	<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
	<script type="text/javascript" charset="utf-8" src="${base}/resources/admin/neditor/neditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="${base}/resources/admin/neditor/neditor.all.min.js"> </script>
	<script type="text/javascript" charset="utf-8" src="${base}/resources/admin/neditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript">

        var _upeditor;
		$().ready(function() {

            var $inputForm = $("#inputForm");

            [@flash_message /]
            var ue = UE.getEditor('editor');

            _upeditor = UE.getEditor('upload_ue');
            _upeditor.ready(function(){
                _upeditor.hide();
                _upeditor.addListener('beforeInsertImage',function(t,arg){
                    $('#icon_url').val(arg[0].src);
                });
            });

            // 表单验证
            $inputForm.validate({
                rules: {
                    "news.title": "required",
                    "news.content": "required",
                    "news.status" : "required",
                    "news.icon_url": "required",
                    "news.orders": "digits"
                }
            });

        });
        
        function browserImg() {
            _upeditor.getDialog("insertimage").open();
        }
        
	</script>
	<style type="text/css">
		table.input td {
			line-height: 15px;
			padding: 5px;
			color: #666666;
			border-bottom: 1px solid #dde9f5;
		}
	</style>

</head>
<body>
<div class="path">
	<a href="${base}/admin/common/index">${message("admin.path.index")}</a> &raquo; 添加新闻信息
</div>
<form id="inputForm" action="save" method="post">
	<table class="input">
		<tr>
			<th>
				<span class="requiredField">*</span>标题:
			</th>
			<td>
				<input type="text" name="news.title" class="text" maxlength="200" />
			</td>
		</tr>
		<tr>
			<th>
				副标题:
			</th>
			<td>
				<input type="text" name="news.sub_title" class="text" maxlength="200" />
			</td>
		</tr>
		<tr>
			<th>
				<span class="requiredField">*</span>是否在新闻资讯显示:
			</th>
			<td>
				<select name="news.status">
					<option value="OFFLINE">不显示</option>
					<option value="ONLINE">显示</option>
				</select>
			</td>
		</tr>
		<tr>
			<th>
				排序:
			</th>
			<td>
				<input type="text" name="news.orders" title="按数字从大到小排序" class="text" maxlength="9" />
                <span class="tips">"按数字从大到小排序"</span>
			</td>
		</tr>
		<tr>
			<th>
				<span class="requiredField">*</span>图标:
			</th>
			<td>
				<script type="text/plain" id="upload_ue"></script>
				<input id ="icon_url" type="text" name="news.icon_url" readonly = "true" class="text" maxlength="200" />
				<input id="btn_browser" type="button" class="button" value="选择图片" onclick="browserImg()" />
			</td>
		</tr>
		<tr>
			<th>
				<span class="requiredField">*</span>内容:
			</th>
			<td>
				<!--<input type="text" name="news.content" class="text" maxlength="200" />-->
				<script id="editor" type="text/plain" name="news.content"  style="width:100%;height:300px;"></script>
			</td>
		</tr>
		<tr>
			<th>
				&nbsp;
			</th>
			<td>
				<input type="submit" class="button" value="${message("admin.common.submit")}" />
				<input type="button" id="backButton" class="button" value="${message("admin.common.back")}" />
			</td>
		</tr>
	</table>
</form>
</body>
</html>